package com.mmall.pay.enums;

/**
 * @author gg
 * @version PayPlatformTypeEnum.java, v 0.1 2019-05-23 9:23 gg
 */
public enum PayPlatformTypeEnum {

    WE_CHAT(1, "WE_CHAT"),
    ALI_PAY(2, "ALIPAY"),
    ;

    private String desc;
    private Integer code;

    PayPlatformTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Getter method for property <tt>value</tt>.
     *
     * @return property value of value
     */
    public Integer getCode() {
        return code;
    }

    public static PayPlatformTypeEnum getByValue(Integer value) {
        PayPlatformTypeEnum[] valueList = PayPlatformTypeEnum.values();
        for (PayPlatformTypeEnum v : valueList) {
            if (v.getCode().equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static String getName(Integer value) {
        PayPlatformTypeEnum[] valueList = PayPlatformTypeEnum.values();
        for (PayPlatformTypeEnum v : valueList) {
            if (v.getCode().equals(value)) {
                return v.getDesc();
            }
        }
        return null;
    }
}